@import '../styles/themes/default';

$spin: 'snake-spin';

.#{$spin} {
  font-size: $body;
  display: inline-block;
  position: relative;

  &-wrapper {
    .#{$spin}-loading {
      position: absolute;
      height: 100%;
      width: 100%;
      z-index: 2;
      background: rgba(#fff, 0.7);

      &-container {
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
      }
    }
  }

  &-loading {
    &-icon {
      display: block;
      text-align: center;
    }

    &-text {
      color: $brand;
      text-align: center;
    }
  }

  &-sk-child {
    width: 100%;
    height: 100%;
    position: absolute;
    left: 0;
    top: 0;

    &::before {
      content: '';
      display: block;
      margin: 0 auto;
      width: 15%;
      height: 15%;
      background-color: $brand;
      border-radius: 100%;
      animation: sk-circleBounceDelay 1.2s infinite ease-in-out both;
    }
  }

  &-sk-circle2 {
    transform: rotate(30deg);

    &::before {
      animation-delay: -1.1s;
    }
  }

  &-sk-circle3 {
    transform: rotate(60deg);

    &::before {
      animation-delay: -1s;
    }
  }

  &-sk-circle4 {
    transform: rotate(90deg);

    &::before {
      animation-delay: -0.9s;
    }
  }

  &-sk-circle5 {
    transform: rotate(120deg);

    &::before {
      animation-delay: -0.8s;
    }
  }

  &-sk-circle6 {
    transform: rotate(150deg);

    &::before {
      animation-delay: -0.7s;
    }
  }

  &-sk-circle7 {
    transform: rotate(180deg);

    &::before {
      animation-delay: -0.6s;
    }
  }

  &-sk-circle8 {
    transform: rotate(210deg);

    &::before {
      animation-delay: -0.5s;
    }
  }

  &-sk-circle9 {
    transform: rotate(240deg);

    &::before {
      animation-delay: -0.4s;
    }
  }

  &-sk-circle10 {
    transform: rotate(270deg);

    &::before {
      animation-delay: -0.3s;
    }
  }

  &-sk-circle11 {
    transform: rotate(300deg);

    &::before {
      animation-delay: -0.2s;
    }
  }

  &-sk-circle12 {
    transform: rotate(330deg);

    &::before {
      animation-delay: -0.1s;
    }
  }

  &-small {
    .#{$spin}-default-spin {
      width: 24px;
      height: 24px;
    }
  }

  &-default-spin {
    display: inline-block;
    width: 32px;
    height: 32px;
    position: relative;
    margin: 0;
  }
}

@keyframes sk-circleBounceDelay {
  0%,
  80%,
  100% {
    transform: scale(0);
  }

  40% {
    transform: scale(1);
  }
}
